package com.example.demo.main;

import android.content.Context;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.RecyclerView;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;

import com.example.demo.DemoOneFragment;
import com.example.demo.R;
import com.example.demo.adapter.GameAdapter;
import com.example.demo.entity.Game;
import com.example.demo.fragment.GameFragment;
import com.example.demo.fragment.SoftWareFragment;

import java.util.ArrayList;
import java.util.List;

public class PlaceholderFragment extends Fragment {

    private static final String ARG_SECTION_NUMBER = "section_number";


    public static PlaceholderFragment newInstance(String title)
    {
        PlaceholderFragment fragment = new PlaceholderFragment();
        Bundle bundle = new Bundle();
        bundle.putString(ARG_SECTION_NUMBER, title);
        // 在Fragment里面设置参数
        fragment.setArguments(bundle);
        return fragment;
    }

    @Override
    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
    }

    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
    {
        return inflater.inflate(R.layout.fragment_place_holder, container, false);
    }

    @Override
    public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState)
    {
        super.onViewCreated(view, savedInstanceState);
        //tvContent = view.findViewById(R.id.tv_content);

        // 取出参数
        Bundle bundle = getArguments();
        if (bundle.getString(ARG_SECTION_NUMBER).equals("推荐")){
            getChildFragmentManager().beginTransaction()
                    .replace(R.id.one, GameFragment.class, null)
                    .commit();
        }


        //tvContent.setText(bundle.getString(ARG_SECTION_NUMBER, "-"));

    }
}
